package code19_jdk8.stream;

import java.util.Arrays;
import java.util.List;

//交易
public class Transaction {
	private Trader trader;// 交易员
	private int year;// 交易年份
	private int value;// 交易额

	public Transaction() {
		super();
	}

	public Transaction(Trader trader, int year, int value) {
		super();
		this.trader = trader;
		this.year = year;
		this.value = value;
	}

	public static List<Transaction> getData() {
		Trader t1 = new Trader("Neo", "南京");
		Trader t2 = new Trader("Jerry", "上海");
		Trader t3 = new Trader("Tom", "北京");
		Trader t4 = new Trader("Alice", "南京");
		return Arrays.asList(
				new Transaction(t1, 2001, 1300), 
				new Transaction(t2, 2002, 2000), 
				new Transaction(t3, 2001, 1400),
				new Transaction(t1, 2002, 1710),
				new Transaction(t2, 2002, 1680),
				new Transaction(t4, 2001, 1930),
				new Transaction(t1, 2001, 1750));
	}

	public Trader getTrader() {
		return trader;
	}

	public void setTrader(Trader trader) {
		this.trader = trader;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	@Override
	public String toString() {
		return "Transaction [trader=" + trader + ", year=" + year + ", value="
				+ value + "]";
	}
}
